package com.starleague.trait;

import com.starleague.entity.IEntityVisitor;

public abstract class AbstractTraitValue<VALUE>
        extends AbstractTrait
        implements ITraitValue<VALUE>
{
    private VALUE traitValue;

    protected AbstractTraitValue(String name,
                                 String label,
                                 VALUE traitValue)
    {
        super(name, label);
        this.traitValue = traitValue;
    }

    protected AbstractTraitValue()
    {
        // For serialization
    }

    @Override
    public VALUE getTraitValue()
    {
        return this.traitValue;
    }

    @Override
    public void setTraitValue(VALUE traitValue)
    {
        this.traitValue = traitValue;
    }

    @Override
    public void accept(IEntityVisitor visitor)
    {
        super.accept(visitor);
        visitor.visit(TRAIT_VALUE, this.traitValue);
    }
}
